import type { MutationTree, ActionTree, GetterTree } from 'vuex'
import type { IRootState } from './index'
import { Actions, Mutations } from '@/enum/policy'

export interface IPolicy {
  fetchingData: false
}

export const state: () => IPolicy = () => ({
  fetchingData: false,
})

export const mutations: MutationTree<IPolicy> = {
  [Mutations.SET_FETCHING_DATA](state, payload) {
    state.fetchingData = payload
  },
}

export const actions: ActionTree<IPolicy, IRootState> = {
  // [Actions.UPDATE_SELECT_RESOURCE]({ commit }, payload) {
  //   commit(Mutations.SET_SELECT_RESOURCE, payload)
  // },
}

export const getters: GetterTree<IPolicy, IRootState> = {
  fetchingData: (state) => state.fetchingData,
}
